import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;


public class HexToInt extends JFrame{
	
	JTextField input, output;
	
	public HexToInt() {
		super("HexToInt");
		
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setSize(400, 100);
		
		input = new JTextField();
		this.add(input, BorderLayout.NORTH);
		
		JButton button = new JButton("Convert");
		this.add(button, BorderLayout.CENTER);
		button.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent e) {
				output.setText(Integer.valueOf(input.getText().toUpperCase(), 16).toString());
				System.out.println(Integer.toBinaryString(Integer.valueOf(input.getText().toUpperCase(), 16)));
			}
		});
		
		output = new JTextField();
		this.add(output, BorderLayout.SOUTH);
		
		this.setVisible(true);
		
	}
	
	public static void main(String[] args) {
		new HexToInt();
	}
}
